package com.example.demo.service.impl;

import com.example.demo.dao.PersonDao;
import com.example.demo.dao.UserDao;
import com.example.demo.service.PersonService;

public class PersonServiceimpl implements PersonService {

    private PersonDao personDao;
    private UserDao userDao;

    //构造器注入
//    public PersonServiceimpl(PersonDao personDao, UserDao userDao) {
//        this.personDao = personDao;
//        this.userDao = userDao;
//    }

    @Override
    public void drink() {
        System.out.println("drink water");
        personDao.eat();
        userDao.save();

    }

    //set方法注入
    public void setPersonDao(PersonDao personDao) {
        this.personDao = personDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
